package com.spring.nio.core.channel.context;

import com.spring.nio.core.channel.pipeline.ChannelPipeLine;
import com.spring.nio.service.chat.frame.ChatMessageFrame;
import lombok.Data;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.util.List;
import java.util.concurrent.BlockingQueue;

/**
 * @author: YSFY
 * @date: 2021-03-25 15:13
 * @pacage_name: com.spring.nio.core.channel.context
 * @class_name: SocketChannelContext
 * @description: 每新接入一个SocketChannel会形成一个SocketChannelContext上下文对象
 */

@Data
public class SocketChannelContext {

    /**
     * 当前通道本地地址即远程地址
     * */
    private String localAddress, remoteAddress;

    /**
     * 当前通道对象
     */
    private SocketChannel socketChannel;

    /**
     * 当前通道指定的处理管道
     * */
    private ChannelPipeLine channelPipeLine;

    /**
     * 当前通道数据队列
     * */
    private BlockingQueue<Object> blockingQueue;

    /**
     * 当前通道待处理集合
     * */
    private List<Object> realList;

    /**
     * 当前通道读取数据缓冲区
     * */
    private ByteBuffer byteBuffer;

    /**
     * 当前通道即将要处理的数据
     * */
    private Object data;
}
